package musicbox;

import java.util.Scanner;


public interface MusicBox {
	void play();
}

public class PianoBox implements MusicBox{
	public void play() {
		System.out.println("It's PianoBox");
	}
	
}

public class ViolinBox implements MusicBox{
	public void play() {
		System.out.println("It's ViolinBox");
	}

}


public class MusicBoxFactory {
	public static MusicBox getInstance (String className){
		MusicBox box = null;
		if("PianoBox".equals(className)){
			box=new PianoBox();
		}
		if("ViolinBox".equals(className)){
		 box=new ViolinBox();
		}
		return box;
	}
	public static void main(String[] args) {
			Scanner in= new Scanner(System.in);
			System.out.println("What Music Box do you want?");
			String input=in.next();
			MusicBox box=MusicBoxFactory.getInstance(input);
			if(box!=null){
				box.play();
			}
	}

}
